<?php

try {

	// 链接数据库
	$db = new PDO("mysql:host=127.0.0.1;dbname=school;charset=utf8","root","root");
	// 发送sql
	// $res = $db->query("delete from stu where sid>20");
	// var_dump($res);

	$res = $db->query("select * from stu");

	$data = $res->fetchAll(PDO::FETCH_ASSOC);

	var_dump($data);

	
} catch (PDOException $e) {
	exit("数据执行失败");
	// var_dump($e);
	
}


